package code;

import java.lang.reflect.Array;
import java.util.Arrays;

public class CodeDemo1 {
    public static int n1 ;
    public static String[] names = new String[5];
    // 静态代码块:有static修饰, 在类加载的时候执行, 只执行一次
    //基本作用：可以完成对类的静态资源的初始化
    static {
        System.out.println("静态代码块执行了");
        n1 = 10;
        names[0] = "jack";
        names[1] = "tom";
        names[2] = "marry";
        names[3] = "marry";
        names[4] = "marry";
    }

    public static void main(String[] args) {
        //目标：认识代码块
        System.out.println("main方法执行了");
        System.out.println(n1);
        System.out.println(Arrays.toString(names));
    }
}
